<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('任务调度_GIT资源库列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>资源库名称：</label>
                                <input type="text" name="repositoryName" th:value="${repoName}" readonly/>
                                <input id="repositoryId" type="hidden" name="repositoryId" th:value="${repoId}">
                            </li>
                            <li>
                                <label>文件名称：</label>
                                <input type="text" name="fName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:file:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:file:remove')}]];
        var prefix = ctx + "busi/repository_file/";
        var selectedIds = [[${selectedIds}]].split(",");
        var datas = [[${@dict.getType('file_type')}]];
        var sys_normal_disable = [[${@dict.getType('sys_normal_disable')}]];

        $(function() {
            var repoId = $("#repositoryId").val();
            var options = {
                url: prefix + "/list2/"+repoId,
                modalName: "任务调度_GIT资源库",
                columns: [{
                    checkbox: true,
                    formatter: function (value,row,index) {

                        for (var i = 0; i<selectedIds.length; i++) {
                            if (selectedIds[i] === (row.id+'')) {
                                return true;
                            }
                        }
                        return false;
                    }
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'repositoryName',
                    title: '资源库名称'
                },
                {
                    field: 'fName',
                    title: '文件名称'
                },
                {
                    field: 'fType',
                    title: '文件类型'
                },
                {
                    field: 'type',
                    title: '类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, row.type);
                    }
                },
                {
                    field: 'status',
                    title: '是否启用',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(sys_normal_disable, value);
                    }
                }]
            };
            $.table.init(options);

        });

        function submitHandler() {
            var rows = $.table.selectColumns("id");
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.close();
            return rows.join();
        }
    </script>
</body>
</html>